/*    */ package com.zimbra.cs.service.mail;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.common.soap.MailConstants;
/*    */ import com.zimbra.cs.mailbox.Flag;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.OperationContext;
/*    */ import com.zimbra.cs.mailbox.Tag;
/*    */ import com.zimbra.cs.service.util.ItemIdFormatter;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class GetTag
/*    */   extends MailDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 42 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 43 */     Mailbox mbox = getRequestedMailbox(zsc);
/* 44 */     OperationContext octxt = getOperationContext(zsc, context);
/* 45 */     ItemIdFormatter ifmt = new ItemIdFormatter(zsc);
/*    */     
/* 47 */     List<Tag> tags = null;
/*    */     try {
/* 49 */       tags = mbox.getTagList(octxt);
/*    */     }
/*    */     catch (ServiceException e) {
/* 52 */       if (!e.getCode().equals("service.PERM_DENIED")) {
/* 53 */         throw e;
/*    */       }
/*    */     }
/* 56 */     Element response = zsc.createElement(MailConstants.GET_TAG_RESPONSE);
/* 57 */     if (tags != null) {
/* 58 */       for (Tag tag : tags) {
/* 59 */         if ((tag != null) && (!(tag instanceof Flag)))
/*    */         {
/* 61 */           ToXML.encodeTag(response, ifmt, octxt, tag); }
/*    */       }
/*    */     }
/* 64 */     return response;
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/mail/GetTag.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */